package com.dawnling.androidutils.ui;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Point;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;
import com.dawnling.androidutils.R;
import com.dawnling.androidutils.view.MyPaintView;
import com.dawnling.androidutils.view.MyPaintView1;

/**
 * 触摸屏幕画线
 */
public class DrawLinesActivity extends AppCompatActivity {

    private boolean isPoint = false;
    private MyPaintView1 myPaintView1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_draw_lines);

        isPoint = getIntent().getBooleanExtra("isPoint", false);
        final MyPaintView myPaintView = findViewById(R.id.myPaintView);
        myPaintView1 = findViewById(R.id.myPaintView1);
        TextView textView = findViewById(R.id.textView);
        if (isPoint) {
            myPaintView.setVisibility(View.GONE);
            myPaintView1.setVisibility(View.VISIBLE);
            textView.setText("点击画点连线");
        } else {
            myPaintView.setVisibility(View.VISIBLE);
            myPaintView1.setVisibility(View.GONE);
            textView.setText("签名画布");
        }

        findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ToastUtils.showShort("清空");
                myPaintView1.clearDraw();
            }
        });
    }
}
